using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class playercreateinfo_item : MangosBase
	{
		public System.Byte? race;
		public System.Byte? class_;
		public System.UInt32? itemid;
		public System.Byte? amount;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `playercreateinfo_item` (`race`, `class`, `itemid`, `amount`) VALUES ('{0}', '{1}', '{2}', '{3}');", race.GetValueOrDefault(), class_.GetValueOrDefault(), itemid.GetValueOrDefault(), amount.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `playercreateinfo_item` SET ");
			if(class_ != null)
			{
				sb.AppendLine("`class`='" + class_.Value.ToString() + "'");
			}
			if(itemid != null)
			{
				sb.AppendLine("`itemid`='" + itemid.Value.ToString() + "'");
			}
			if(amount != null)
			{
				sb.AppendLine("`amount`='" + amount.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `race`='" + race.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
